package com.lb.bs.client.processor.enums;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

/**
 * program: lb-bs-client
 * author: bsworld.xie
 * create: 2020-05-24 10:27
 * description:
 */
public class DefaultValues {

    public enum Booleans {
        TRUE("true"), FALSE("false");

        private String value;

        Booleans(String value) {
            this.value = value;
        }

        private static List<String> allBooleanValues = new ArrayList<>();

        static {
            for (Booleans booleans : EnumSet.allOf(Booleans.class)) {
                allBooleanValues.add(booleans.value);
            }
        }

        public static boolean contains(String value) {
            return allBooleanValues.contains(value);
        }
    }


    public enum LogLevels {
        ALL("all"),
        TRACE("trace"),
        DEBUG("debug"),
        INFO("info"),
        WARN("warn"),
        ERROR("error"),
        FATAL("fatal"),
        OFF("off"),

        ;
        private String value;

        LogLevels(String value) {
            this.value = value;
        }

        private static List<String> allLevelValues = new ArrayList<>();

        static {
            EnumSet<LogLevels> logLevels = EnumSet.allOf(LogLevels.class);
            for (LogLevels logLevel : logLevels) {
                allLevelValues.add(logLevel.value);
                allLevelValues.add(logLevel.value.toUpperCase());
            }
        }

        public static boolean contains(String value) {
            return allLevelValues.contains(value);
        }
    }


}
